
pkgname=wget
pkgver=1.19.5
pkgrel=2
pkgdesc="A network utility to retrieve files from the Web"
arch=('x86_64')
url="https://www.gnu.org/software/wget/wget.html"
license=('GPL3')
groups=('base')
depends=('glibc' 'openssl' 'libidn' 'util-linux' 'pcre' 'libpsl')
optdepends=('ca-certificates: HTTPS downloads')
backup=('etc/wgetrc')
source=("https://ftpmirror.gnu.org/wget/${pkgname}-${pkgver}.tar.lz"
        '0001-main.c-Need-to-explicitly-disallow-show_progress-in-.patch')
md5sums=('4ee511011a15f4207bea8b2993c343ee'
         '87ebe95f2c403e041fab209610e695ae')

build() {
  cd ${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/0001-main.c-Need-to-explicitly-disallow-show_progress-in-.patch
  
  cat >> doc/sample.wgetrc <<EOF

# default root certs location
ca_certificate=/etc/ssl/certs/ca-certificates.crt
EOF

  ./configure --prefix=/usr --sysconfdir=/etc -with-ssl=openssl --enable-nls
  make
}

package() {
  cd ${pkgname}-${pkgver}
  
  make DESTDIR=${pkgdir} install
}
